# Created by: Olivier Duchateau
# $FreeBSD$
#

PORTNAME=	fifth-leg-fonts
PORTVERSION=	0.6
CATEGORIES=	x11-fonts
MASTER_SITES=	https://api.opensuse.org/public/source/%SUBDIR%/
MASTER_SITE_SUBDIR=	openSUSE:Factory/${PORTNAME:S/s//}
DISTNAME=	opensuse-font-fifth-leg-${PORTVERSION}

MAINTAINER=	olivierd@FreeBSD.org
COMMENT=	Font for the openSUSE Brand

LICENSE=	OFL
LICENSE_NAME=	Open Font License
LICENSE_FILE=	${WRKSRC}/COPYING
LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

BUILD_DEPENDS=	mkfontscale:${PORTSDIR}/x11-fonts/mkfontscale \
		mkfontdir:${PORTSDIR}/x11-fonts/mkfontdir
RUN_DEPENDS=	fc-cache:${PORTSDIR}/x11-fonts/fontconfig

USE_BZIP2=	yes
USE_XORG=	x11
NO_WRKSUBDIR=	yes

FONTNAME=	5th-leg
FONTDIR=	${PREFIX}/lib/X11/fonts/${FONTNAME}

PLIST_SUB=	FONTDIR="${FONTDIR:S|${PREFIX}/||}" \
		FCCACHE="${FCCACHE}"

SUB_FILES=	pkg-message
PKGMESSAGE=	${WRKDIR}/pkg-message
SUB_LIST=	FONTDIR=${FONTDIR}

MKFONTSCL_CMD=	${LOCALBASE}/bin/mkfontscale
MKFONTDIR_CMD=	${LOCALBASE}/bin/mkfontdir
FCCACHE=	${LOCALBASE}/bin/fc-cache -f -v

do-build:
		@cd ${WRKSRC} && \
			${MKFONTSCL_CMD} ; ${MKFONTDIR_CMD}

do-install:
		@${MKDIR} ${STAGEDIR}${FONTDIR}
		@cd ${WRKSRC} && \
			${INSTALL_DATA} fonts.* *.otf ${STAGEDIR}${FONTDIR}

post-install:
		-${FCCACHE} ${STAGEDIR}${FONTDIR}

.include <bsd.port.mk>
